﻿<%@ Page Language="C#" Theme="WebMaster" MasterPageFile="~/WebMaster/MasterPage.master" AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="webapp4U.UI.WebMaster_Default" %>
<%@ Register Src="~/WebMaster/Controls/Title.ascx" TagName="Title" TagPrefix="uc" %>
<%@ Import Namespace="webapp4U" %>
<%@ Register TagPrefix="webapp4U" Namespace="webapp4U.UI" %>

<asp:Content ID="Content1" ContentPlaceHolderID="PageContent" Runat="Server">

<uc:Title runat="server" ResourceKey='Product_Manager'/>

<div>

<asp:UpdatePanel ID="UserUpdatePanel" runat="server" UpdateMode="Conditional">
    <ContentTemplate>

<table border="0" width="100px" cellpadding="0"  cellspacing="0" align="center">
   
  <tr>
       <td align="center">
            <asp:Panel runat="server" GroupingText="TÌM KIẾM SẢN PHẨM" Font-Bold="true" ForeColor="black">
                <table width="100%" border="0" cellpadding="0" cellspacing="0" align="center">
                    <tr>
                        <td align="center" Height="40px">
                            <span class="text"><%=ResourceManager.GetString("Search") %>:</span> 
                            <webapp4U:ddlCategory runat="server" ID="dlCategory" CssClass="Textbox" Width="200px" />        
                            <webapp4U:ddlCompany runat="server" ID="dlCompany" CssClass="Textbox" Width="200px" />        
                            <asp:TextBox runat="server" CssClass="textbox" ID="txtKeyword" Width="100px" Text=""></asp:TextBox>
                            <asp:Button runat="server" ID="Button1" OnClick="btSearch_Click" Text="Search" CssClass="textbox" />        
                        </td>
                    </tr>
                </table>
            </asp:Panel>
        </td>
    </tr>
    <tr>
        <td style="padding-top:15px;">
            <a class="linkAdd" href="ProductAdd.aspx?CateID=<%=Globals.GetIntFromQueryString("CateID")%>"><%=ResourceManager.GetString("Product_Add") %></a>
        </td>
   </tr>
    <tr>
        <td style="padding-top:5pt;" align="center">
            <asp:GridView runat="server" Width="700px" HorizontalAlign="Center" 
                ID="GridViewItem"                 
                AutoGenerateColumns="false" 
                AllowPaging="True" 
                AllowSorting="True" 
                PagerSettings-Mode="NumericFirstLast"
                GridLines="none">
                <Columns>
                    <asp:TemplateField ItemStyle-HorizontalAlign="Center" ItemStyle-Width="20px" HeaderStyle-Width="20px"
                        HeaderText="Delete">
                        <HeaderTemplate>
                            <input id="chkAll" onclick="javascript:SelectAllCheckboxes(this);" runat="server" type="checkbox" />
                        </HeaderTemplate>
                        <ItemTemplate>
                            <asp:CheckBox runat="server" ID="chkSelect" ToolTip='<%# Eval("ProductID") %>' />
                        </ItemTemplate>
                    </asp:TemplateField>
                                                        
                    <asp:TemplateField HeaderText="Image" 
                        HeaderStyle-Width="60" ItemStyle-Width="50"
                        HeaderStyle-HorizontalAlign="Left"
                        ItemStyle-HorizontalAlign="left">
                        <HeaderTemplate><%=ResourceManager.GetString("Image") %></HeaderTemplate>
                        <ItemTemplate>
                            <table>
                                <tr>
                                    <td align="center" width="41px" height="41px" style="border:solid 1px #cccccc; cursor:pointer">
                                        <img alt="" border="0" src='<%=Globals.ApplicationPath %>UserUpload/Products/<%# Eval("ImageUrl") %>' width="150px" height="150px" />  
                                       
                                    </td>
                                </tr>
                            </table>
                             
                        </ItemTemplate>
                    </asp:TemplateField>
                    
                    <asp:TemplateField HeaderText="Sản phẩm" 
                        HeaderStyle-Width="200" ItemStyle-Width="200" ItemStyle-Height="40"
                        HeaderStyle-HorizontalAlign="Left"
                        ItemStyle-HorizontalAlign ="left">
                        <ItemTemplate>
                            <%# Eval("Title") %>
                        </ItemTemplate>
                    </asp:TemplateField>
                    
                    <asp:TemplateField HeaderText="Ngôn ngữ" 
                        HeaderStyle-Width="100" ItemStyle-Width="100" ItemStyle-Height="40"
                        HeaderStyle-HorizontalAlign="Left"
                        ItemStyle-HorizontalAlign ="left">
                        <ItemTemplate>
                            <%# Eval("LanguageCode") %>
                        </ItemTemplate>
                    </asp:TemplateField>
                    
                    <asp:TemplateField HeaderText="Giá bán(VND)" 
                        HeaderStyle-Width="100" ItemStyle-Width="100"
                        HeaderStyle-HorizontalAlign="Left"
                        ItemStyle-HorizontalAlign ="left">
                        <ItemTemplate>
                              <span style="font-weight:normal"><%# Formatter.FormatMoney((Decimal)Eval("UnitPrice"))%></span>
                        </ItemTemplate>
                    </asp:TemplateField>
                    
                     <asp:TemplateField HeaderText="Nhà SX" 
                        HeaderStyle-HorizontalAlign="Left"
                        ItemStyle-HorizontalAlign ="left">
                        <ItemTemplate>
                               <%#webapp4U.BOL.Companies.GetCompanyName((Int32)Eval("CompanyID")) %>
                        </ItemTemplate>
                    </asp:TemplateField>
                    
                    <asp:TemplateField HeaderStyle-Width="40px" ItemStyle-Width="40px" HeaderText="Edit"
                        HeaderStyle-HorizontalAlign="Center" ItemStyle-HorizontalAlign="Center">
                        <HeaderTemplate><%=ResourceManager.GetString("Edit") %></HeaderTemplate>
                        <ItemTemplate>
                            <asp:HyperLink runat="server" ID="lnkEdit" ImageUrl="~/WebMaster/Images/Edit.gif" NavigateUrl='<%# "ProductAdd.aspx?ProductID=" + (int)Eval("ProductID")+"&Action=Edit" %>'></asp:HyperLink>
                        </ItemTemplate>
                    </asp:TemplateField>
                </Columns>
                <EmptyDataTemplate>
                    <table align="center" width="100%" border="0" bgcolor="#ffffcc" bordercolorlight="#0099cc"  bordercolor="#0099cc">
                        <tr>
                            <td height="50" align="center">
                                <div align="center" id="EmptyData"><%=ResourceManager.GetString("DataEmpty")%></div>
                            </td>   
                        </tr>
                    </table>
                </EmptyDataTemplate>
            </asp:GridView>            
        </td>
    </tr>
    <tr>
        <td align="right">
        <br />
        <asp:Button runat="server" ID="btDelete" Text=" Delete " OnClick="btDelete_Click" /></td>
    </tr>
    
   
            
    </table>

    </ContentTemplate>
</asp:UpdatePanel>

    <br />     
    <br />     
    
</div>

    

<asp:ObjectDataSource
    ID="SearchDataSource"
    runat="server"
    SelectMethod="Search"
    TypeName="webapp4U.BOL.Products">
    <SelectParameters>
        <asp:ControlParameter ControlID="txtKeyword" Name="Keyword" PropertyName="Text" Type="string" DefaultValue=" "  />
        <asp:ControlParameter ControlID="dlCategory" Name="CateID" PropertyName="SelectedValue" Type="int32" DefaultValue="-1"  />
        <asp:ControlParameter ControlID="dlCompany" Name="CompanyID" PropertyName="SelectedValue" Type="int32" DefaultValue="-1"  />
    </SelectParameters>
</asp:ObjectDataSource>


 <%--<asp:ObjectDataSource
    ID="ItemDataSource"
    runat="server"
    SelectMethod="GetAllProducts"
    TypeName="webapp4U.BOL.Products">
</asp:ObjectDataSource>--%>

</asp:Content>

